<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>康复跟踪</title>
    <script src="/static/mobile/js/mui.min.js"></script>
    <link href="/static/mobile/css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="/static/mobile/css/basic.css"/>
    <link rel="stylesheet" type="text/css" href="/static/mobile/css/resiter_daili.css"/>
    <script type="text/javascript" src="/static/mobile/js/jquery.js"></script>
	<link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <script type="text/javascript" charset="utf-8">
      	mui.init();
    </script>
	<style>
		.section2 .sub button {
			width: 100%;
			padding: 5px;
			font-size: 1rem;
			color: #fff;
			background: #E52D2D;
			border-color: #E52D2D;
		}
	</style>
</head>
<body>
	<div class="sectionx">
		<header class="mui-bar mui-bar-nav" >
			<a class="mui-icon mui-icon-left-nav mui-pull-left" href="javascript:history.back(-1)" style="color: #4E4E4E;"></a>
			<h1 class="mui-title">康复跟踪</h1>
			<!--<a class="mui-icon mui-icon  mui-pull-right right1" href="pay_record.html" style="color: #4E4E4E;font-size: 0.8rem;padding-top: 18px;">转账记录</a>-->
		</header>
	</div>
	<div class="section2">
		<div class="layui-form">
		<form class="layui-form layui-form-pane" lay-filter="form-system">
					<div class="layui-form-item">
						<label class="layui-form-label">康复图片</label>
						<input type="hidden" name="logo" id="logo">
						<div class="layui-input-block">
							<div class="layui-upload">
								<button type="button" class="layui-btn layui-btn-primary" id="logoBtn"><i class="icon icon-upload3"></i>点击上传</button>
								<div class="layui-upload-list">
									<img class="layui-upload-img" id="cltLogo">
									<p id="demoText"></p>
								</div>
							</div>
						</div>
					</div>
		</form>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button type="button" class="layui-btn" lay-filter="sub" lay-submit>确定</button>
			</div>
		</div>
		</div>
	</div>
	
	
</body>
<script type="text/javascript" >
    mui('body').on( 'tap' , 'a' , function(){
        document.location.href=this.href;
    })
</script>
<script src="/static/plugins/layui/layui.js"></script>
<script>
	layui.use(['form', 'layer','upload','element'], function () {
		var form = layui.form,layer = layui.layer,upload = layui.upload,$ = layui.jquery,element = layui.element;
		//普通图片上传
		var uploadInst = upload.render({
			elem: '#logoBtn'
			,url: '{:url("admin/UpFiles/upload")}'
			,before: function(obj){
				//预读本地文件示例，不支持ie8
				obj.preview(function(index, file, result){
					$('#cltLogo').attr('src', result); //图片链接（base64）
				});
			}
			,done: function(res){
				//上传成功
				if(res.code>0){
					$('#logo').val(res.url);
				}else{
					//如果上传失败
					return layer.msg('上传失败');
				}
			}
			,error: function(){
				//演示失败状态，并实现重传
				var demoText = $('#demoText');
				demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
				demoText.find('.demo-reload').on('click', function(){
					uploadInst.upload();
				});
			}
		});
	})
	layui.use(['form', 'layer'], function () {
		var form = layui.form,$ = layui.jquery;
		// 登录提交监听
		form.on('submit(sub)', function (data) {
			var loading = layer.load(1, {shade: [0.1, '#fff']});
			$.post("{:url('chuan')}",data.field,function(res){
				layer.close(loading);
				if(res.code > 0){
					layer.msg(res.msg,{time:1000,icon:1},function(){
						location.href = "{:url('chuan')}";
					});
				}else{
					layer.msg(res.msg,{time:1000,icon:2});
					$('.captcha img').attr('src','{:url("verify")}?id='+Math.random());
				}
			});
		})
	})
</script>


</html>